class Solution
{
public:
    int valueAfterKSeconds(int n, int k)
    {
        vector<int> nums(n, 1);

        for (int i = 0; i < k; ++i)
        {
            for (int j = 1; j < n; ++j)
            {
                nums[j] += nums[j - 1];
                nums[j] %= 1'0000'0000'7;
            }
        }
        return nums[n - 1];
    }
};